import 'dart:convert';


class Data {
  final bool state;
  final String message;
  final dynamic data;
  final Map<String, dynamic>? ui;
  final String? nextRoute;
  final List<dynamic>? errors;

  Data({
    required this.state,
    required this.message,
    required this.data,
    required this.ui,
    required this.nextRoute,
    this.errors,
  });

  factory Data.fromRawJson(String str) => Data.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory Data.fromJson(Map<String, dynamic> json) => Data(
    state: json["state"],
    message: json["message"]??"",
    data: json["data"],
    ui: json["ui"],
    errors: json["errors"],
    nextRoute: json["next_route"],
  );

  Map<String, dynamic> toJson() => {
    "state": state,
    "message": message,
    "data": data,
    "ui": ui,
    "errors": errors,
    "next_route": nextRoute,
  };
}


